﻿using NPOI.SS.Formula.Functions;
using System.Collections.Generic;
using System.Net.Http;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using TyMES.Services;
using Elsa.Server.Api.Endpoints.WorkflowDefinitions;
using Newtonsoft.Json;
using TyMES.Communication.Request;
using TyMES.Model.BaseInformation;

namespace TyMES.Communication
{
    public class FactoryAPIBase
    {

        public class ApiResponse<T> 
        {
            [JsonPropertyName("code")]
            public string Code { get; set; }
            [JsonPropertyName("data")]
            public List<T> Data { get; set; } = new List<T>();
            [JsonPropertyName("fail")]
            public bool Fail { get; set; }
            [JsonPropertyName("mesg")]
            public string Mesg { get; set; }
            [JsonPropertyName("success")]
            public bool Success { get; set; }
            [JsonPropertyName("time")]
            public string Time { get; set; }
        }
        public class ApiResponse
        {
            [JsonPropertyName("code")]
            public string Code { get; set; }
            [JsonPropertyName("data")]
            public string Data { get; set; } 
            [JsonPropertyName("fail")]
            public bool Fail { get; set; }
            [JsonPropertyName("mesg")]
            public string Mesg { get; set; }
            [JsonPropertyName("success")]
            public bool Success { get; set; }
            [JsonPropertyName("time")]
            public string Time { get; set; }
        }
        public abstract class BaseRequest
        {
            [JsonPropertyName("serviceId")]
            public string ServiceId { get; set; }
            [JsonPropertyName("factoryCode")]
            public string FactoryCode { get; set; } = "TH13";
            //[JsonPropertyName("appId")]
            //public string AppId { get; set; }
            //[JsonPropertyName("appKey")]
            //public string AppKey { get; set; }
            //public void AddCommonHeaders(HttpRequestMessage request)
            //{
            //    request.Headers.Add("appId", AppId);
            //    request.Headers.Add("appKey", AppKey);
            //}
        }


    }
}
